module.exports = {
  queryWordSql: `SELECT *
    FROM english_words_meaning
    WHERE english_word_id = (SELECT id FROM english_words WHERE word = ?);`,
  insertWordAndPronSql: `
    INSERT INTO english_words VALUES(DEFAULT,?,?);
    `,
  hasWordSql: `
    SELECT true
    FROM english_words
    WHERE word = ?
    LIMIT 1; 
    `,
  getWordIdSql: ` SELECT id from english_words WHERE word=?`,
  hasWordMeaningSql: `SELECT true from english_words_meaning WHERE english_word_id=?`,
  getInsertDefinitionSql(params) {
    const keys = Object.keys(params).join(",");
    const values = Object.values(params)
      .map((item) => `"${item}"`)
      .join(",");
    return `INSERT INTO english_words_meaning (english_word_id, ${keys}) SELECT id, ${values} FROM english_words WHERE word = ?;  `;
  },
};
